home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Speccy ClassiX 1998
/
Speccy ClassiX 98.iso
/
amiga_system
/
the_aminet
/
comm
/
tcp
/
slip_call30b1e.lha
/
SLIPCall30Eng
/
SLIPCall
< prev
next >
Wrap
Text File
|
1995-09-25
|
37KB
|
1,096 lines
/* SLIPCall 3.0 beta 1 English */
/* */
/* Av Thomas Egrelius (thomas@fotoslide.bmc.uu.se) */
/* */
if ~show('L', "rexxsupport.library") then
if ~addlib('rexxsupport.library', 0, -30, 0) then exit 41
if ~show('L', "rexxserdev.library") then
if ~addlib('rexxserdev.library', 0, -30, 5) then exit 42
options results
/*signal on error*/ /* Funkar inte med MBWatch */
signal on halt
signal on break_c
signal on break_d
prefsfile = 'S:SLIPCall.config'
qual1 = 'ctrl '
qual2 = ''
qual3 = ''
key = 'f1'
action = ''
poll = 0
win = 1
if arg() > 0 then do
do x = 1 to words(arg(1))
if upper(left(word(arg(1),x),2)) = '-C' then prefsfile = right(word(arg(1),x),wordlength(arg(1),x)-2)
if upper(left(word(arg(1),x),3)) = '-Q1' then qual1 = right(word(arg(1),x),wordlength(arg(1),x)-3)||' '
if upper(left(word(arg(1),x),3)) = '-Q2' then qual2 = right(word(arg(1),x),wordlength(arg(1),x)-3)||' '
if upper(left(word(arg(1),x),3)) = '-Q3' then qual3 = right(word(arg(1),x),wordlength(arg(1),x)-3)||' '
if upper(left(word(arg(1),x),2)) = '-K' then key = right(word(arg(1),x),wordlength(arg(1),x)-2)
if upper(left(word(arg(1),x),2)) = '-A' then action = upper(right(word(arg(1),x),wordlength(arg(1),x)-2))
if upper(left(word(arg(1),x),2)) = '-P' then poll = 1
if upper(left(word(arg(1),x),2)) = '-W' then win = 0
end
end
if action ~= 'DIAL' & action ~= 'RESUME' & action ~= '' then do
say 'Wrong argument: -A'action
exit
end
version = '$VER:SLIPCall 3.0b1e (25.9.95)'
cr = '0d'x
/**************************************
**** Definitioner av f÷nstren ****
**************************************/
'zInterface SLIPCall Hotkey="'qual1||qual2||qual3||key'" PersistFile="'prefsfile'"'
'zImage Magnify Width=11 Height=9 Depth=1 Data="3E006300C180C180C18063003EC000E00060"'
'zImage Folder Width=11 Height=9 Depth=1 Data="7800840087E0F8208020802080208020FFE0"'
/*** Huvudf÷nster ***/
'zWindow WMain Label "SLIPCall 3.0b1e: Hotkey = <'qual1||qual2||qual3||key'>" Open Centered CloseEvent ChildMaxWidth'
'zMenu Project'
'zObject Button MAbout Label "&About..." Cause "zDoMethod WAbout Open"'
'zObject Line'
'zObject Button MHide Label "&Hide" Cause "zDoMethod SLIPCall Deactivate"'
'zObject Button MQuit Label "&Quit" SelectEvent'
'zEndMenu'
'zMenu Action'
'zObject Button MRing Label "&Dial" SelectEvent"'
'zObject Button MResume Label "&Resume" SelectEvent'
'zObject Button MAvsluta Label "&Hangup" SelectEvent'
'zEndMenu'
'zMenu Preferences'
'zObject Button MPrefs Label "&Change..." SelectEvent'
'zEndMenu'
'zGroup Horizontal'
'zGroup Vertical'
'zObject TextDisplay IP NumColumns 40 Label "IP:"'
'zObject TextDisplay HostName Numcolumns 40 Label "Name:"'
'zObject TextDisplay Status Label "Status:" NumColumns 40 Value "Offline"'
'zEndGroup'
'zObject Line'
'zGroup Vertical ChildMaxWidth'
'zObject Button BRing Label "&Dial" SelectEvent'
'zObject Button BResume Label "&Resume" SelectEvent'
'zObject Button BAvsluta Label "H&angup" SelectEvent'
'zEndGroup'
'zEndGroup'
'zObject Line'
'zGroup Horizontal'
'zObject Button BHide Label "&Hide" Cause "zDoMethod SLIPCall Deactivate"'
'zObject Button BPrefs Label "&Preferences..." SelectEvent'
'zObject Button BAbout Label "&About..." Cause "zDoMethod WAbout Open"'
'zObject Button BQuit Label "&Quit" SelectEvent'
'zEndGroup'
'zEndWindow'
/*** Aboutrequester ***/
'zWindow WAbout Label "About SLIPCall..." NoClose Blocking Justification Center Alignment Center'
'zGroup Horizontal'
'zObject StdI Image Which=Information'
'zObject Line'
'zGroup Vertical ChildMaxWidth'
'zObject TextDisplay A1 NoBorder Value "SLIPCall 3.0 beta 1 (1995-09-25)"'
'zObject TextDisplay A4 NoBorder Value "English version"'
'zObject TextDisplay A2 NoBorder Value "Copyright ⌐1995 Thomas Egrelius"'
'zObject TextDisplay A3 NoBorder Value "email: egge@canit.se"'
'zEndGroup'
'zEndGroup'
'zObject Line'
'zObject Button AOK Label " &OK " Cause "zDoMethod WAbout Close"'
'zEndWindow'
/*** Varningsf÷nster ***/
'zWindow WError Label "SLIPCall Message" NoClose Blocking Justification Center Alignment Center'
'zGroup Horizontal'
'zObject StdI Image Which=Exclamation'
'zObject Line'
'zGroup Vertical ChildMaxWidth'
'zObject TextDisplay E1 NoBorder Value "Incorrect value!"'
'zObject TextDisplay E2 NoBorder Value ""'
'zObject TextDisplay E3 NoBorder Value ""'
'zEndGroup'
'zEndGroup'
'zObject Line'
'zObject Button EOK Label " &OK " Cause "zDoMethod WError Close"'
'zEndWindow'
/*** NoAmitcp f÷nster ***/
'zWindow WFault Label "SLIPCall Message" NoClose Blocking Justification Center Alignment Center'
'zGroup Horizontal'
'zObject StdI Image Which=Stop'
'zObject Line'
'zGroup Vertical ChildMaxWidth'
'zObject TextDisplay F1 NoBorder Value "Cannot find AmiTCP!"'
'zObject TextDisplay F2 NoBorder Value "Quitting..."'
'zEndGroup'
'zEndGroup'
'zObject Line'
'zObject Button EOK Label "&Quit" SelectEvent'
'zEndWindow'
/*** Betainformation ***/
'zWindow WBeta Label "SLIPCall Message" NoClose Blocking Justification Center Alignment Center'
'zGroup Horizontal'
'zObject StdI Image Which=Information'
'zObject Line'
'zGroup Vertical ChildMaxWidth'
'zObject TextDisplay E1 NoBorder Value "This functions is not implemented yet."'
'zEndGroup'
'zEndGroup'
'zObject Line'
'zObject Button BOK Label " &OK " Cause "zDoMethod WBeta Close"'
'zEndWindow'
/*** InstΣllningar ***/
'zWindow WPrefs Label "Preferences" NoClose Blocking ChildMaxWidth'
'zGroup Horizontal'
'zGroup Vertical'
'zGroup Horizontal ChildMaxHeight'
'zObject TextEntry PLogPath Persist Label "&Logpath:" MaxChars 100 NumColumns 32 Value "S:"'
'zObject ButtonG PLogPathG Glyph=Folder UpEvent'
'zEndGroup'
'zObject TextEntry PPollcommand Persist Label "Poll&command:" MaxChars 64 NumColumns 32'
'zObject TextEntry PUsername Persist Label "AmiTCP &user:" MaxChars 20 NumColumns 32 Value "<username>"'
'zObject TextEntry PRetries Persist Label "&Retries:" MaxChars 3 NumColumns 32 Value "10" ChangeEvent'
'zGroup Horizontal'
'zObject Button PClock Label "Cloc&k" SelectEvent'
'zObject TextEntry PClocktext Persist MaxChars 10 NumColumns 10 ChangeEvent Value "Show"'
'zEndGroup'
'zEndGroup'
'zObject Line'
'zGroup Vertical ChildMaxWidth'
'zObject Button PHost Label "&Provider" Cause "zDoMethod WPrefsHost Open"'
'zObject Button PModem Label "&Modem" Cause "zDoMethod WPrefsModem Open"'
'zObject Button PScript Label "S&cript" Cause "zDoMethod WPrefsScript Open"'
'zEndGroup'
'zEndGroup'
'zObject Line'
'zGroup Horizontal'
'zObject Button PSave Label "&Save" SelectEvent'
'zObject Button PSaveAs Label "Save &as..." SelectEvent'
'zObject Button PLoad Label "&Open..." SelectEvent'
'zObject Button PCancel Label "&Cancel" SelectEvent'
'zEndGroup'
'zEndWindow'
/*** InstΣllningar - Leverant÷r ***/
'zWindow WPrefsHost Label "Provider Preferences" NoClose Blocking ChildMaxWidth'
'zObject TextEntry PHostName Persist Label "&Provider:" MaxChars 64 NumColumns 20'
'zObject TextEntry PPhone Persist Label "P&hone:" MaxChars 20 NumColumns 20'
'zObject TextEntry PDomain Persist Label "H&ostname:" MaxChars 32 NumColumns 20'
'zObject TextEntry PHostIP Persist Label "Host&IP:" MaxChars 15 NumColumns 20 Value "0.0.0.0"'
'zObject TextEntry PNameserver Persist Label "&Nameserver:" MaxChars 15 NumColumns 20 Value "0.0.0.0"'
'zObject TextEntry PGateway Persist Label "&Gateway:" MaxChars 15 NumColumns 20 Value "0.0.0.0"'
'zObject TextEntry PStatic Persist Label "Static IP:" MaxChars 15 NumColumns 20 Value "0.0.0.0"'
'zObject TextEntry PMTU Persist Label "&MTU:" MaxChars 4 NumColumns 20 Value "1500"'
'zObject Line'
'zGroup Horizontal'
'zObject Button PProtocol Label "&Protocol" SelectEvent'
'zObject TextEntry PPrototext Persist Value "CSLIP" NumColumns 10 ChangeEvent'
'zObject Button PDynamic Label "Address method" SelectEvent'
'zObject TextEntry PDyntext Persist Value "Dynamic" NumColumns 10 ChangeEvent'
'zEndGroup'
'zObject Line'
'zGroup Horizontal ChildMaxWidth'
'zObject Button HostOK Label "&Save" SelectEvent'
'zObject Button HostCancel Label "&Cancel" SelectEvent'
'zEndGroup'
'zEndWindow'
/*** InstΣllningar - Modem ***/
'zWindow WPrefsModem Label "Modem Preferences" NoClose Blocking ChildMaxWidth'
'zObject TextEntry PInit Persist Label "Modem&Init:" MaxChars 64 NumColumns 20 Value "AT&F0&D0"'
'zObject TextEntry PReset Persist Label "Modem&Reset:" MaxChars 64 NumColumns 20 Value "ATZ"'
'zObject Line'
'zObject TextEntry PDevice Persist Label "&Device:" MaxChars 64 NumColumns 20 Value "serial.device"'
'zGroup Horizontal ChildMaxWidth Alignment Center'
'zGroup Vertical NoMargY ChildMaxWidth'
'zObject Button PUnit Label "&Unit" SelectEvent'
'zObject TextEntry PUnittext Persist MaxChars 1 NumColumns 10 ChangeEvent Value "0"'
'zObject Button PSpeed Label "S&peed" SelectEvent'
'zObject TextEntry PSpeedtext Persist MaxChars 6 NumColumns 10 ChangeEvent Value "38400"'
'zObject Button PHShake Label "Hands&hake" SelectEvent'
'zObject TextEntry PHShaketext Persist MaxChars 10 NumColumns 10 ChangeEvent Value "RTS/CTS"'
'zEndGroup'
'zObject Line'
'zGroup Vertical Align NoMargy ChildMaxWidth'
'zObject Button PBits Label "Data&bits" SelectEvent'
'zObject TextEntry PBitstext Persist MaxChars 1 NumColumns 10 ChangeEvent Value "8"'
'zObject Button PParity Label "&Parity" SelectEvent'
'zObject TextEntry PParitytext Persist MaxChars 10 NumColumns 10 ChangeEvent Value "None" '
'zObject Button PStops Label "Stopbi&ts" SelectEvent'
'zObject TextEntry PStopstext Persist MaxChars 1 NumColumns 1 ChangeEvent Value "1"'
'zEndGroup'
'zEndGroup'
'zObject Line'
'zGroup Horizontal ChildMaxWidth'
'zObject Button ModemOK Label "&Save" SelectEvent'
'zObject Button ModemCancel Label "&Cancel" SelectEvent'
'zEndGroup'
'zEndWindow'
/*** InstΣllningar - Script ***/
'zWindow WPrefsScript Label "Login Script" Blocking ChildMaxWidth'
'zGroup Horizontal ChildMaxHeight'
'zObject Button SB1 Label "W/S" SelectEvent'
'zObject TextEntry ST1 Persist MaxChars 8 NumColumns 8 ChangeEvent Value "Wait for"'
'zObject TextEntry S1 Persist MaxChars 64 NumColumns 30'
'zEndGroup'
'zGroup Horizontal ChildMaxHeight'
'zObject Button SB2 Label "W/S" SelectEvent'
'zObject TextEntry ST2 Persist MaxChars 8 NumColumns 8 ChangeEvent Value "Send"'
'zObject TextEntry S2 Persist MaxChars 64 NumColumns 30'
'zEndGroup'
'zGroup Horizontal ChildMaxHeight'
'zObject Button SB3 Label "W/S" SelectEvent'
'zObject TextEntry ST3 Persist MaxChars 8 NumColumns 8 ChangeEvent Value "Wait for"'
'zObject TextEntry S3 Persist MaxChars 64 NumColumns 30'
'zEndGroup'
'zGroup Horizontal ChildMaxHeight'
'zObject Button SB4 Label "W/S" SelectEvent'
'zObject TextEntry ST4 Persist MaxChars 8 NumColumns 8 ChangeEvent Value "Send"'
'zObject TextEntry S4 Persist MaxChars 64 NumColumns 30'
'zEndGroup'
'zGroup Horizontal ChildMaxHeight'
'zObject Button SB5 Label "W/S" SelectEvent'
'zObject TextEntry ST5 Persist MaxChars 8 NumColumns 8 ChangeEvent Value "Wait for"'
'zObject TextEntry S5 Persist MaxChars 64 NumColumns 30'
'zEndGroup'
'zGroup Horizontal ChildMaxHeight'
'zObject Button SB6 Label "W/S" SelectEvent'
'zObject TextEntry ST6 Persist MaxChars 8 NumColumns 8 ChangeEvent Value "Send"'
'zObject TextEntry S6 Persist MaxChars 64 NumColumns 30'
'zEndGroup'
'zGroup Horizontal ChildMaxHeight'
'zObject Button SB7 Label "W/S" SelectEvent'
'zObject TextEntry ST7 Persist MaxChars 8 NumColumns 8 ChangeEvent Value "Wait for"'
'zObject TextEntry S7 Persist MaxChars 64 NumColumns 30'
'zEndGroup'
'zGroup Horizontal ChildMaxHeight'
'zObject Button SB8 Label "W/S" SelectEvent'
'zObject TextEntry ST8 Persist MaxChars 8 NumColumns 8 ChangeEvent Value "Send"'
'zObject TextEntry S8 Persist MaxChars 64 NumColumns 30'
'zEndGroup'
'zGroup Horizontal ChildMaxHeight'
'zObject Button SB9 Label "W/S" SelectEvent'
'zObject TextEntry ST9 Persist MaxChars 8 NumColumns 8 ChangeEvent Value "Wait for"'
'zObject TextEntry S9 Persist MaxChars 64 NumColumns 30'
'zEndGroup'
'zGroup Horizontal ChildMaxHeight'
'zObject Button SB10 Label "W/S" SelectEvent'
'zObject TextEntry ST10 Persist MaxChars 8 NumColumns 8 ChangeEvent Value "Send"'
'zObject TextEntry S10 Persist MaxChars 64 NumColumns 30'
'zEndGroup'
'zObject Line'
'zGroup Horizontal ChildMaxWidth'
'zObject Button ScriptOK Label "&Save" SelectEvent'
'zObject Button ScriptCancel Label "&Cancel" SelectEvent'
'zEndGroup'
'zEndWindow'
'zEndInterface'
/*** Starta upp... ***/
if ~exists('AmiTCP:') then do
'zDoMethod WFault Open'
call run()
end
flags.call = 0
flags.serclosed = 1
flags.tcponline = 0
if win then 'zDoMethod SLIPCall Activate'
call Initialize()
if poll then do
prefs.clock = 0
call MRing_Select()
address command prefs.pollcommand
call MQuit_Select()
end
if action = 'DIAL' then call MRing_Select()
if action = 'RESUME' then call MResume_Select()
run:
do forever
'zWaitForEvent stem.'
interpret "zRC="RESULT"()"
end
/*** Funktioner som hanterar GUI events ***/
/*** Avsluta ***/
halt:
break_c:
MQuit_Select:
BQuit_Select:
WMain_Close:
SLIPCall_Quit:
call MAvsluta_Select()
exit
break_d:
call MAvsluta_Select()
return 0
EOK_Select:
'zDoMethod WFault Close'
exit
Error:
call MAvsluta_Select()
if rc=20 then do
say "Must be run with zrx!"
exit
end
say "Error" RC "at line" SIGL " (errnum="zErrNum")"
exit
BPrefs_Select:
MPrefs_Select:
if connected ~= 1 then 'zDoMethod WPrefs Open'
return 0
/*** Ring ***/
BRing_Select:
MRing_Select:
flags.call = 1
dh = SerOpen(prefs.device, prefs.unit)
if (dh == 0) then do
'zSetAttr E1 Value "Serious Error!"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Cannot open 'prefs.device'"'
'zDoMethod WError Open'
return 0
end
flags.serclosed = 0
check = SerClear(dh)
check = SerSetParms(dh, prefs.speed, prefs.databits, prefs.paritet, prefs.stopbits, prefs.handshake, 250000, 4096)
buffer = AllocMem(4096)
junk = c2d(buffer)
check = 0
connected = 0
SerWrite(dh, prefs.modeminit, length(prefs.modeminit))
do x = 1 to prefs.retries
'zSetAttr Status Value "Dialing '||prefs.hostname||', ('||x||' of '||prefs.retries||')."'
do forever
Delay(100)
if (check == 0) then do
result = SerWrite(dh, 'ATDT'||prefs.hostphone||cr, length('ATDT'||prefs.hostphone||cr))
check = 1
totalstr = ''
end
status = SerQuery(dh)
parse upper var status valid bytes_read .
rcvdstrg = SerRead(dh, junk, bytes_read)
totalstr = totalstr||rcvdstrg
check = modem_query(totalstr)
check2 = 0
if (check == 100) then leave
if (check == 101) then do; check = 0; check2 = 1; 'zSetAttr Status Value "Busy..."'; Delay(100); end
if (check == 102) then do; check = 0; check2 = 1; 'zSetAttr Status Value "No carrier..."'; Delay(100); end
if (check == 103) then do; check = 0; check2 = 1; 'zSetAttr Status Value "No answer..."'; Delay(100); end
if check2 then leave
end
if (check == 100) then leave
end
if check ~= 100 then do; call CloseSer(); 'zSetAttr Status Value "Offline"'; return 0; end
connected = 1
parse var totalstr .'CONNECT ' linespeed+5 +2 totalstr
if prefs.clock then do
if ~show('p', 'MBWATCH.01') then address command 'run >NIL: <NIL: mbwatch start logtime 10'
else do
address mbwatch.01 reset
address mbwatch.01 start
end
end
'zSetAttr Status Value "Connected to 'prefs.hostname' at 'linespeed' bps."'
if ~exists(prefs.logpath) then do
call Open(logfile, prefs.logpath, 'W')
writeln(logfile, '')
call Close(logfile)
end
if Open(logfile, prefs.logpath, 'A') then do
writeln(logfile, '')
writeln(logfile, date()||' '||time()||' Connected to '||prefs.hostname||' at '||prefs.hostphone)
call Close(logfile)
end
call login()
return 0
/*** ┼teruppta ***/
BResume_Select:
MResume_Select:
if exists('ENVARC:ip') then do
slipip = 0
if Open(file, 'ENVARC:ip', 'R') then do
slipip = readln(file)
slipip = slipip||' '
call Close(file)
end
if prefs.clock then do
if ~show('P', 'MBWATCH.01') then address command 'run >NIL: <NIL: mbwatch logtime 10'
address 'MBWATCH.01' 'START'
end
'zSetAttr Status Value "Trying to resume connection to 'prefs.hostname'..."'
address command 'copy ENVARC:ip ENV:ip'
if ~exists('ENV:Sana2') then address command 'makedir ENV:Sana2'
address command 'echo >ENV:Sana2/rhslip0.config "'prefs.device prefs.unit prefs.speed '$ip MTU='prefs.mtu' 7WIRE"'
if ip ~= 0 then 'zSetAttr IP Value "'||left(slipip,length(slipip)-2)'"'
call startnet()
connected = 1
end
else do
'zSetAttr Status Value "Cannot resume lost connection!"'
Delay(300)
flags.call = 1
connected = 1
call hangup()
end
return 0
/*** LΣgg pσ ***/
BAvsluta_Select:
MAvsluta_Select:
if connected = 1 then do
'zSetAttr Status Value "Finnishing connection..."'
if flags.tcponline then do
address command 'AmiTCP:bin/offline 'prefs.slipdevice
flags.tcponline = 0
end
Delay(100)
if flags.serclosed then do
dh = SerOpen(prefs.device, prefs.unit)
flags.serclosed = 0
check = SerClear(dh)
check = SerSetParms(dh, prefs.speed, prefs.databits, prefs.paritet, prefs.stopbits)
end
call hangup()
if show('P', 'AMITCP') then address 'AMITCP' 'KILL'
'zSetAttr IP Value " "'
'zSetAttr HostName Value " "'
'zSetAttr Status Value "Offline"'
end
return 0
/*** InstΣllningar - AnvΣnd ***/
PSave_Select:
'zDoMethod WPrefs Save'
'zDoMethod WPrefs Close'
call Initialize()
return 0
/*** InstΣllningar - Spara som... ***/
PSaveAs_Select:
'zDoMethod WBeta Open'
return 0
/*** InstΣllningar - Ladda ***/
PLoad_Select:
'zDoMethod WBeta Open'
return 0
/*** InstΣllningar - Avbryt ***/
PCancel_Select:
'zDoMethod WPrefs Restore'
'zDoMethod WPrefs Close'
call initialize()
return 0
PProtocol_Select:
'zGetAttr PPrototext Value'
if result = "CSLIP" then 'zSetAttr PPrototext Value "SLIP"'
else 'zSetAttr PPrototext Value "CSLIP"'
return 0
PPrototext_Change:
'zGetAttr PPrototext Value'
value = result
if upper(result) ~= "CSLIP" & upper(result) ~= "SLIP" then do
'zSetAttr E1 Value "Incorrect value!"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Protocol: 'value'"'
'zDoMethod WError Open'
'zSetAttr PPrototext Value "CSLIP"'
end
return 0
PDynamic_Select:
'zGetAttr PDyntext Value'
if upper(result) = "DYNAMIC" then 'zSetAttr PDyntext Value "Static"'
else 'zSetAttr PDyntext Value "Dynamic"'
return 0
PDyntext_Change:
'zGetAttr PDyntext Value'
value = result
if upper(result) ~= "DYNAMIC" & upper(result) ~= "STATIC" then do
'zSetAttr E1 Value "Incorrect value"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Address method: 'value'"'
'zDoMethod WError Open'
'zSetAttr PDyntext Value "Dynamic"'
end
return 0
PUnit_Select:
'zGetAttr PUnittext Value'
enhet = result + 1
if enhet > 9 then enhet = 0
'zSetAttr PUnittext Value "'||enhet||'"'
return 0
PUnittext_Change:
'zGetAttr PUnittext Value'
value = result
if result < "0" | result > "9" then do
'zSetAttr E1 Value "Incorrect value!"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Unit: 'value'"'
'zDoMethod WError Open'
'zSetAttr PUnittext Value "0"'
end
return 0
PSpeed_select:
'zGetAttr PSpeedtext Value'
hastighet = result
if hastighet = "115200" then hastighet = "1200"
if hastighet = "57600" then hastighet = "115200"
if hastighet = "38400" then hastighet = "57600"
if hastighet = "19200" then hastighet = "38400"
if hastighet = "14400" then hastighet = "19200"
if hastighet = "9600" then hastighet = "14400"
if hastighet = "2400" then hastighet = "9600"
if hastighet = "1200" then hastighet = "2400"
'zSetAttr PSpeedtext Value "'||hastighet||'"'
return 0
PSpeedtext_Change:
'zGetAttr PSpeedtext Value'
value = result
if result ~= "115200" & result ~= "57600" & result ~= "38400" & result ~= "19200" & result ~= "14400" & result ~= "9600" & result ~= "2400" then do
'zSetAttr E1 Value "Incorrect value!"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Speed: 'value'"'
'zDoMethod WError Open'
'zSetAttr PSpeedtext Value "38400"'
end
return 0
PHShake_Select:
'zGetAttr PHShaketext Value'
handshake = result
if handshake = "RTS/CTS" then handshake = "XON/XOFF"
else handshake = "RTS/CTS"
'zSetAttr PHShaketext Value "'||handshake||'"'
return 0
PHShaketext_Change:
'zGetAttr PHShaketext Value'
value = result
if upper(result) ~= "RTS/CTS" & upper(result) ~= "XON/XOFF" then do
'zSetAttr E1 Value "Incorrect value!"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Handshake: 'value'"'
'zDoMethod WError Open'
'zSetAttr PHShaketext Value "RTS/CTS"'
end
return 0
PBits_Select:
'zGetAttr PBitstext Value'
bits = result +1
if bits > 8 then bits = 1
'zSetAttr PBitstext Value "'||bits||'"'
return 0
PBitstext_Change:
'zGetAttr PBitstext Value'
value = result
if result < "1" | result > "8" then do
'zSetAttr E1 Value "Incorrect value!"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Databits: 'value'"'
'zDoMethod WError Open'
'zSetAttr PBitstext Value "8"'
end
return 0
PParity_Select:
'zGetAttr PParitytext Value'
paritet = result
if paritet = "Space" then paritet = "X"
if paritet = "Mark" then paritet = "Space"
if paritet = "Odd" then paritet = "Mark"
if paritet = "Even" then paritet = "Odd"
if paritet = "None" then paritet = "Even"
if paritet = "X" then paritet = "None"
'zSetAttr PParitytext Value "'||paritet||'"'
return 0
PParitytext_Change:
'zGetAttr PParitytext Value'
value = result
if upper(result) ~= "SPACE" & upper(result) ~= "MARK" & upper(result) ~= "ODD" & upper(result) ~= "EVEN" & upper(result) ~= "NONE" then do
'zSetAttr E1 Value "Incorrect value!"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Parity: 'value'"'
'zDoMethod WError Open'
'zSetAttr PParitytext Value "None"'
end
return 0
PStops_Select:
'zGetAttr PStopstext Value'
stopbits = result + 1
if stopbits > 2 then stopbits = 1
'zSetAttr PStopstext Value "'||stopbits||'"'
return 0
PStopstext_Change:
'zGetAttr PStopstext Value'
value = result
if result < "1" | result > "2" then do
'zSetAttr E1 Value "Incorrect value!"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Stopbits: 'value'"'
'zDoMethod WError Open'
'zSetAttr PStopstext Value "1"'
end
return 0
SB1_Select:
call ScriptChangeValue(ST1)
return 0
ST1_Change:
call ScriptCheckValue(ST1)
return 0
SB2_Select:
call ScriptChangeValue(ST2)
return 0
ST2_Change:
call ScriptCheckValue(ST2)
return 0
SB3_Select:
call ScriptChangeValue(ST3)
return 0
ST3_Change:
call ScriptCheckValue(ST3)
return 0
SB4_Select:
call ScriptChangeValue(ST4)
return 0
ST4_Change:
call ScriptCheckValue(ST4)
return 0
SB5_Select:
call ScriptChangeValue(ST5)
return 0
ST5_Change:
call ScriptCheckValue(ST5)
return 0
SB6_Select:
call ScriptChangeValue(ST6)
return 0
ST6_Change:
call ScriptCheckValue(ST6)
return 0
SB7_Select:
call ScriptChangeValue(ST7)
return 0
ST7_Change:
call ScriptCheckValue(ST7)
return 0
SB8_Select:
call ScriptChangeValue(ST8)
return 0
ST8_Change:
call ScriptCheckValue(ST8)
return 0
SB9_Select:
call ScriptChangeValue(ST9)
return 0
ST9_Change:
call ScriptCheckValue(ST9)
return 0
SB10_Select:
call ScriptChangeValue(ST10)
return 0
ST10_Change:
call ScriptCheckValue(ST10)
return 0
PRetries_Change:
'zGetAttr PRetries Value'
value = result
if ~datatype(value, 'N') then do
'zSetAttr E1 Value "Incorrect value!"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Retries: 'value'"'
'zDoMethod WError Open'
'zSetAttr PRetries Value "20"'
end
return 0
PClock_Select:
'zGetAttr PClocktext Value'
if upper(result) = "SHOW" then 'zSetAttr PClocktext Value "Hide"'
else 'zSetAttr PClocktext Value "Show"'
return 0
PClocktext_Change:
'zGetAttr PClocktext Value'
value = result
if upper(result) ~= "SHOW" & upper(result) ~= "HIDE" then do
'zSetAttr E1 Value "Incorrect value!"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Clock: 'value'"'
'zDoMethod WError Open'
'zSetAttr PClocktext Value "Show"'
end
return 0
PLogPathG_Change:
'zGetAttr PLogPath Value'
'zRequest Directory Label "Choose path for the logfile:" Value "'result'"'
'zSetAttr PLogPath Value "'||result||'"'
return 0
HostOK_Select:
'zDoMethod WPrefsHost Save'
'zDoMethod WPrefsHost Close'
return 0
HostCancel_Select:
'zDoMethod WPrefsHost Restore'
'zDoMethod WPrefsHost Close'
return 0
ModemOK_Select:
'zDoMethod WPrefsModem Save'
'zDoMethod WPrefsModem Close'
return 0
ModemCancel_Select:
'zDoMethod WPrefsModem Restore'
'zDoMethod WPrefsModem Close'
return 0
ScriptOK_Select:
'zDoMethod WPrefsScript Save'
'zDoMethod WPrefsScript Close'
return 0
ScriptCancel_Select:
'zDoMethod WPrefsScript Restore'
'zDoMethod WPrefsScript Close'
return 0
ScriptChangeValue:
parse arg gadget
'zGetAttr 'gadget' Value'
if upper(result) = "WAIT FOR" then 'zSetAttr 'gadget' Value "Send"'
else 'zSetAttr 'gadget' Value "Wait for"'
return 0
ScriptCheckValue:
parse arg gadget
'zGetAttr 'gadget' Value'
value = result
if upper(result) ~= "WAIT FOR" & upper(result) ~= "SEND" then do
'zSetAttr E1 Value "Incorrect value!"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Script: 'value'"'
'zDoMethod WError Open'
'zSetAttr 'gadget' Value "Wait for"'
end
return 0
Initialize:
'zSetAttr Status Value "Initializing SLIPCall..."'
'zGetAttr PLogPath Value'
prefs.logpath = result'SLIPCalls.log'
'zGetAttr PPollcommand Value'
prefs.pollcommand = result
'zGetAttr PUsername Value'
prefs.username = result
'zGetAttr PClocktext Value'
if upper(result) = "SHOW" then prefs.clock = "1"
else prefs.clock = "0"
'zGetAttr PRetries Value'
prefs.retries = result
'zGetAttr PHostName Value'
prefs.hostname = result
'zGetAttr PPhone Value'
prefs.hostphone = result
'zGetAttr PDomain Value'
prefs.hostdomain = result
'zGetAttr PHostIP Value'
prefs.hostip = result
'zGetAttr PNameserver Value'
prefs.nameserver = result
'zGetAttr PGateway Value'
prefs.gateway = result
'zGetAttr PStatic Value'
prefs.statisk = result
'zGetAttr PMTU Value'
prefs.mtu = result
'zGetAttr PPrototext Value'
prefs.protokoll = upper(result)
prefs.slipdevice = 'rhslip.device 0'
prefs.sanadriver = 'slip0'
if prefs.protokoll = 'CSLIP' then do
prefs.slipdevice = 'rhcslip.device 0'
prefs.sanadriver = 'cslip0'
end
'zgetAttr PDyntext Value'
prefs.adressering = upper(result)
'zGetAttr PInit Value'
prefs.modeminit = upper(result)||cr
'zGetAttr PReset Value'
prefs.modemreset = upper(result)||cr
'zGetAttr PDevice Value'
prefs.device = result
'zGetAttr PUnittext Value'
prefs.unit = result
'zGetAttr PSpeedtext Value'
prefs.speed = result
'zGetAttr PHShaketext Value'
if upper(result) = "RTS/CTS" then prefs.handshake = "0"
else prefs.handshake = "1"
'zGetAttr PBitstext Value'
prefs.databits = result
'zGetAttr PParitytext Value'
prefs.paritet = "N"
if upper(result) = "EVEN" then prefs.paritet = "E"
if upper(result) = "ODD" then prefs.paritet = "O"
if upper(result) = "MARK" then prefs.paritet = "M"
if upper(result) = "SPACE" then prefs.paritet = "S"
'zGetAttr PStopstext Value'
prefs.stopbits = result
do x = 1 to 10
'zGetAttr ST'||x||' Value'
if upper(result) = "WAIT FOR" then event.x = "WAIT"
else event.x = "SEND"
'zGetAttr S'||x||' Value'
if result ~= 'RESULT' then string.x = result
else string.x = ''
end
/*** Konfigurera AmiTCP ***/
if ~exists('AmiTCP:db/resolv.conf.bkup') then do
if exists('AmiTCP:db/resolv.conf') then address command 'rename AmiTCP:db/resolv.conf as AmiTCP:db/resolv.conf.bkup'
end
address command 'echo >AmiTCP:db/resolv.conf "DOMAIN 'prefs.hostdomain'"'
address command 'echo >>AmiTCP:db/resolv.conf "NAMESERVER 'prefs.nameserver'"'
'zSetAttr Status Value "Offline"'
return 0
login:
SerWrite(dh, cr, length(cr))
do x=1 to 10
if string.x ~= '' then do
if event.x = "WAIT" then waitresult = wait_str(string.x)
if event.x = "SEND" then SerWrite(dh, string.x||cr, length(string.x||cr))
end
else leave
if waitresult = 10 then do
call FreeMem(buffer, 4096)
return 0
end
end
SerClose(dh)
flags.serclosed = 1
laststring = x - 1
parse var rcvdstr . (string.laststring) ' ' a '.' b '.' c '.' d .
if prefs.adressering = "DYNAMIC" then slipip = a||'.'||b||'.'||c||'.'||d
else slipip = prefs.statisk||' '
'zSetAttr IP Value "'||left(slipip, length(slipip)-2)||' ('time()', 'date()')"'
address command 'echo >ENV:ip '||left(slipip, length(slipip)-2)
address command 'echo >ENVARC:ip '||left(slipip, length(slipip)-2)
/*** Skapa ENV:Sana2/rhslip0.config ***/
if ~exists('ENV:Sana2') then address command 'makedir ENV:Sana2'
address command 'echo >ENV:Sana2/rhslip0.config "'prefs.device prefs.unit prefs.speed '$ip MTU='prefs.mtu' 7WIRE"'
call startnet()
call FreeMem(buffer, 4096)
return 0
wait_str:
teststr = arg(1)
check = 0
timeout = 0
do until (check ~= 0)
status = SerQuery(dh)
parse upper var status valid bytes_read .
rcvdstr = SerRead(dh, junk, bytes_read)
totalstr = totalstr||rcvdstr
check = pos(teststr,totalstr)
timeout = timeout + 1
if timeout = 100 then check = -1
Delay(20)
end
if check = -1 then do
'zSetAttr Status Value "Timeout when waiting for string. Hanging up!"'
Delay(100)
call MAvsluta_Select()
return 10
end
rcvdstr = totalstr
totalstr = ''
return 0
modem_query:
teststr = arg(1)
if (pos('CONNECT' , teststr) ~= 0) then return 100
if (pos('BUSY' , teststr) ~= 0) then return 101
if (pos('NO CARRIER', teststr) ~= 0) then return 102
if (pos('NO ANSWER' , teststr) ~= 0) then return 103
return 200
CloseSer:
call SerClose(dh)
flags.serclosed = 1
return 0
hangup:
if flags.call then do
if connected ~= 0 then do
'zSetAttr Status Value "Hanging up..."'
if flags.serclosed then do
dh = SerOpen(prefs.device, prefs.unit)
if (dh == 0) then do
'zSetAttr E1 Value "Serious Error!"'
'zSetAttr E2 Value ""'
'zSetAttr E3 Value "Cannot open 'prefs.device'"'
'zDoMethod WError Open'
return 0
end
check = SerClear(dh)
check = SerSetParms(dh, prefs.speed, prefs.databits, prefs.paritet, prefs.stopbits, prefs.handshake, 250000, 4096)
end
check = SerWrite(dh, '+++', 3)
check = Delay(100)
check = SerWrite(dh, 'ATH0'||cr, 5)
if Open(logfile, prefs.logpath, 'A') then do
call writeln(logfile, date()||' '||time()||' Connection finnished')
call Close(logfile)
end
connected = 0
end
if prefs.clock then address 'MBWATCH.01' 'QUIT'
Delay(300)
SerWrite(dh, prefs.modemreset||cr, length(prefs.modemreset||cr))
Delay(100)
call SerClose(dh)
flags.serclosed = 1
flags.call = 0
end
return 0
GetHostName:
name = '½Unknown╗'
address command "AmiTCP:bin/hostname >T:actualname"
if Open(file, 'T:actualname', 'R') then do
name = readln(file)
call Close(file)
end
'zSetAttr HostName Value "'name'"'
return 0
startnet:
'zSetAttr Status Value "Starting AmiTCP..."'
address command
'AmiTCP:bin/login -f 'prefs.username
'AmiTCP:bin/umask 022'
'AmiTCP:AmiTCP >NIL:'
'SYS:Rexxc/WaitForPort AMITCP >NIL:'
'AmiTCP:bin/ifconfig lo0 localhost'
'AmiTCP:bin/ifconfig '||prefs.sanadriver||' '||left(slipip, length(slipip)-2)||' '||prefs.hostip||' netmask 255.255.255.0'
'AmiTCP:bin/route add '||left(slipip, length(slipip)-2)||' localhost'
'AmiTCP:bin/route add default '||prefs.gateway
'echo >T:tcpmounter "Assign TCP: Exists >NIL:"'
'echo >>T:tcpmounter "if warn"'
'echo >>T:tcpmounter "mount TCP: from AmiTCP:devs/inet-mountlist"'
'echo >>T:tcpmounter "endif"'
'execute T:tcpmounter >NIL:'
'run AmiTCP:bin/inetd >NIL:'
address
'zSetAttr Status Value "Connected to 'prefs.hostname'!"'
flags.tcponline = 1
call GetHostName()
return 0